package com.java.jikexueyuan.chainms;


import cn.hutool.json.JSONUtil;

/**
 * @author song
 */
public class MainTest {

    public static void main(String[] args) {

        AbstractApprover stockProcess = new StockProcess();
        AbstractApprover speedProcess = new SpeedProcess();
        AbstractApprover distanceProcess = new DistanceProcess();

        ReqDto reqDto = new ReqDto();

        Boolean switchProcess = Boolean.FALSE;

        if (switchProcess) {
            stockProcess.setNextProcess(speedProcess);
            speedProcess.setNextProcess(distanceProcess);
            distanceProcess.setNextProcess(new EndProcess());
            stockProcess.processRequest(reqDto);
        } else {
            speedProcess.setNextProcess(distanceProcess);
            distanceProcess.setNextProcess(stockProcess);
            stockProcess.setNextProcess(new EndProcess());
            speedProcess.processRequest(reqDto);
        }


        System.err.println(JSONUtil.toJsonPrettyStr(reqDto));

    }

}
